import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.Math;
import java.util.ArrayList;

import javax.vecmath.Point2d;

public class PSBuilder extends Applet implements Runnable
{
	private static final long serialVersionUID = 1L;
	int width, height;
	Particle p;
	Thread animator = new Thread(this);
	
	/** List of Particle objects. */
	//ArrayList<Particle>   P = new ArrayList<Particle>();

	/** Main constructor.  Call start() to begin simulation. */
	public PSBuilder()	{}

	public void init() 
	{
		p = new Particle( new Point2d(100, 100) );

		//Thread animator = new Thread(this);
		animator.start();
	}

	 public void paint( Graphics g ) 
	 {
		 p.display(g);
	 }

	public void run() 
	{
		while(true)
		{
			p.advanceTime();
			repaint();
			
			try {
				animator.sleep(100);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
		}
		
	}
	/**
	 * Called by the browser on close to destroy resources allocated.
	 */
	public void destroy()
	{
		//remove stuff

	}
}
